/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package se.kth.lwr.jeat.utils;

import javax.measure.quantity.Duration;
import javax.measure.quantity.Length;
import org.jscience.physics.amount.Amount;
import se.kth.lwr.jeat.core.Activity;

/**A {@link Transportation} with support for idle activities
 *
 * @author davidev
 */
public abstract class IdleSupportedTransportation extends Transportation{
    
    /**The method to support Idle periods in the transportation rout. It should
     * return an activity that reflects the Idle Time of the transportation
     * 
     * @param duration idle time
     * @param comment comment 
     * @return an Activity reflecting the idle time
     */
    protected abstract Activity getIdleActivity(Amount<Duration> duration, String comment);
    
    /**Records an idle time in the transportaion route
     * 
     * @param duration idle time
     * @param comment comment on idle time
     * @return This Transportation
     */
    public IdleSupportedTransportation idle(Amount<Duration> duration, String comment){
        getActivities().add(getIdleActivity(duration, comment));
        return this;
    }
    
    /**
     * Create a new transportation with idle support
     * @param name name of transportation
     */
    public IdleSupportedTransportation(String name) {
        super(name);
    } 
    
    /**Record a transport in the transportation route.
     * 
     * @param distance transport distance
     * @param comment comment on distance
     * @return 
     */
    @Override
    public IdleSupportedTransportation transport(Amount<Length> distance, String comment) {
        super.transport(distance, comment);
        return this;
    }
    
    /**
     * Record a transport in the transportation route
     * @param distance transport distance
     * @param fill filling degree
     * @param comment comment on transport
     * @return 
     */
    @Override
    public IdleSupportedTransportation transport(Amount<Length> distance, double fill, String comment) {
        super.transport(distance, fill, comment);
        return this;
    }
    
    /**
     * Repeat the transportation sequence expressed in the passed argument. The
     * repetition will be expressed as a multiplication with a repeat constant instead
     * of producing separate activities for each repeat.
     * 
     * @param sequence the activity that that compose the transport sequence
     * @param repetitions the number of times to repeat the the route sequence
     * @return this transportation
     */

    @Override
    public IdleSupportedTransportation repeatRoutSequence(Transportation sequence, double times) {
        super.repeatRoutSequence(sequence, times);
        return this;
    }
    
    
    
    
    
    


    
    
    
}
